

$(function () {
    
    /* mapArea */
    var map = new BMap.Map('map');
    var centerPoint = new BMap.Point(121.593478, 38.94871);
    var centerMark = new BMap.Marker(centerPoint);
    map.addOverlay(centerPoint);
    map.centerAndZoom(centerPoint, 16);
    map.setCurrentCity("大连"); 
    map.enableScrollWheelZoom(true);
    var routePolicy = [
        BMAP_TRANSIT_POLICY_LEAST_TIME,
        BMAP_TRANSIT_POLICY_LEAST_TRANSFER,
        BMAP_TRANSIT_POLICY_LEAST_WALKING,
        BMAP_TRANSIT_POLICY_AVOID_SUBWAYS
    ];
    var local = new BMap.LocalSearch(map, {
        renderOptions:{map: map, autoViewport: false}
    });
    
    
    $('.mapOut li').click(function () {
        var content = $(this).html();
        $('.mapOut li').removeClass('current_li');
        $(this).addClass('current_li');
        bounds = map.getBounds();
        local.searchInBounds(content, bounds);
    });
    
    $('.searchLine').click(function () {
        var directArea = $('.directArea').val();
        var transit = new BMap.TransitRoute(map, {    
            renderOptions: {map: map, panel: "results"}    
        }); 
        map.clearOverlays();
        transit.search(centerPoint, directArea);
    });
    
    $('.return').click(function () {
        if(map) {
            map.reset();
        }
    });
    
    $('.imgShow').slick({
        slidesToShow: 1,
        slidesToScroll: 1,
        asNavFor: '.imgList',
        arrows: false,
        fade: true,
    });
    $('.imgList').slick({
        slidesToShow: 3,
        slidesToScroll: 1,
        vertical: true,
        asNavFor: '.imgShow',
        centerMode: true,
        arrows: true,
        focusOnSelect: true
    });
    
    $('.Room dd').click(function () {
        var $_this = $(this);
        var n;
        if(!$_this.hasClass('livedRoom')) {
            n = $_this.index();
            $('.Room dd').removeClass('selectedRoom');
            $_this.addClass('selectedRoom');
        }
    });
});